<!DOCTYPE html>
<html>
<head>
    <meta charset="utf-8"/>
    <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
    <meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1">
    <title>开关配置</title>
    <link rel="stylesheet" href="${ctxPath}/assets/libs/layui/css/layui.css"/>
    <link rel="stylesheet" href="${ctxPath}/assets/module/admin.css"/>
    <style>
        #switchFrom .layui-form-label {
            width: 135px !important;
        }

        #switchFrom .layui-input-block {
            margin-left: 165px !important;
        }
    </style>
</head>

<body>
<!-- 正文开始 -->
<div class="layui-fluid" id="switchFrom">
    <form class="layui-form model-form" style="padding-top: 0px;">
        <input name="appId" type="hidden" value="${appId}"/>
        <div class="layui-card">
            <div class="layui-card-header">
                应用开关配置
            </div>
            <div class="layui-card-body">
                <div class="layui-row">
                    <div class="layui-col-xs12">
                        <div class="layui-form-item">
                            <label class="layui-form-label">接口限流</label>
                            <div class="layui-input-block">
                                <input type="radio" name="accessLimitState" value="0" title="关闭" ${0==config.accessLimitState?'checked':''}/>
                                <input type="radio" name="accessLimitState" value="1" title="开启" ${1==config.accessLimitState?'checked':''}/>
                                <div class="layui-word-aux">接口调用是否限制IP访问次数</div>
                            </div>
                        </div>
                        <div class="layui-form-item">
                            <label class="layui-form-label">用户二要素校验</label>
                            <div class="layui-input-block">
                                <input type="radio" name="realCheckState" value="0" title="关闭" ${0==config.realCheckState?'checked':''}/>
                                <input type="radio" name="realCheckState" value="1" title="开启" ${1==config.realCheckState?'checked':''}/>
                                <div class="layui-word-aux">用户实名是否开启真实校验</div>
                            </div>
                        </div>
                        <div class="layui-form-item">
                            <label class="layui-form-label">渠道IP限制</label>
                            <div class="layui-input-block">
                                <input type="radio" name="channelIPLimitState" value="0" title="关闭" ${0==config.channelIPLimitState?'checked':''}/>
                                <input type="radio" name="channelIPLimitState" value="1" title="开启" ${1==config.channelIPLimitState?'checked':''}/>
                                <div class="layui-word-aux">渠道注册同IP超过次数拉入IP黑名单</div>
                            </div>
                        </div>
                        <div class="layui-form-item">
                            <label class="layui-form-label">助贷API业务</label>
                            <div class="layui-input-block">
                                <input type="radio" name="loanApiState" value="0" title="关闭" ${0==config.loanApiState?'checked':''}/>
                                <input type="radio" name="loanApiState" value="1" title="开启" ${1==config.loanApiState?'checked':''}/>
                                <div class="layui-word-aux">应用是否开启API助贷业务</div>
                            </div>
                        </div>

                        <div class="layui-form-item">
                            <label class="layui-form-label">未注册是否可登陆</label>
                            <div class="layui-input-block">
                                <input type="radio" name="notRegLoginState" value="0" title="关闭" ${0==config.notRegLoginState?'checked':''}/>
                                <input type="radio" name="notRegLoginState" value="1" title="开启" ${1==config.notRegLoginState?'checked':''}/>
                                <div class="layui-word-aux">未注册用户是否可以登陆 </br>是：新增注册用户为默认渠道并登陆 否：用户无法登陆app</div>
                            </div>
                        </div>
                    </div>
                </div>
            </div>
        </div>
        <div class="layui-form-item text-right layui-footer" style="left: 0;">
            <button class="layui-btn layui-btn-primary" type="button" ew-event="closeThisTabs">取消</button>
            <button class="layui-btn" lay-filter="switchSubmit" lay-submit>保存</button>
        </div>
    </form>
</div>

<!-- js部分 -->
<script type="text/javascript" src="${ctxPath}/assets/libs/layui/layui.js"></script>
<script type="text/javascript" src="${ctxPath}/assets/js/common.js"></script>
<script>
    layui.use(['layer', 'form', 'util', 'admin'], function () {
        var $ = layui.jquery;
        var layer = layui.layer;
        var form = layui.form;
        var admin = layui.admin;

        // 表单提交事件
        form.on('submit(switchSubmit)', function (data) {
            layer.load(2);
            var url = '/system/config/saveSwitchConfig';
            $.post(url, data.field, function (res) {
                layer.closeAll('loading');
                if (res.code == 200) {
                    layer.msg(res.msg, {icon: 1});
                    top.layui.admin.closeThisTabs();
                } else {
                    layer.msg(res.msg, {icon: 2});
                }
            }, 'json');
            return false;
        });
    });
</script>


</body>
</html>